package com.cdks.wuxiu.api.service.mysql;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdks.wuxiu.api.component.constant.Constant;
import com.cdks.wuxiu.api.mapper.RechargePriceConfigMapper;
import com.cdks.wuxiu.entity.mysql.RechargePriceConfig;

import java.util.List;

import org.springframework.stereotype.Service;

/**
 * 订单信息表 服务实现类
 */
@Service
public class RechargePriceConfigServiceImpl extends ServiceImpl<RechargePriceConfigMapper, RechargePriceConfig> implements RechargePriceConfigService {

    @Override
    public RechargePriceConfig getByPriceId(int priceId) {
        QueryWrapper<RechargePriceConfig> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(RechargePriceConfig::getPriceId, priceId);

        return baseMapper.selectOne(wrapper);          
    }

    @Override
    public List<RechargePriceConfig> getList(int min, int max) {
        QueryWrapper<RechargePriceConfig> wrapper = new QueryWrapper<>();
        wrapper.lambda().between(RechargePriceConfig::getPriceId, min, max)
                        .eq(RechargePriceConfig::getStatus, Constant.DATA_STATUS_ENABLE)
                        .select(RechargePriceConfig::getType,
                                RechargePriceConfig::getPlat,
                                RechargePriceConfig::getPriceId,
                                RechargePriceConfig::getMoney,
                                RechargePriceConfig::getBean,
                                RechargePriceConfig::getPlus);

        return baseMapper.selectList(wrapper);
    }
}
